package cn.neusoft.exception;

public class ControllerException extends Exception{

    private int type;
    private String message;

    private static final int STANDARD_TYPE = 200;
    private static final String STANDARD_MESSAGE = "错误";

    public ControllerException(int type, String message) {
        this.type = type;
        this.message = message;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static ControllerException throwItself(){
        return new ControllerException(STANDARD_TYPE,STANDARD_MESSAGE);
    }

    public static ControllerException throwItself(int type){
        return new ControllerException(STANDARD_TYPE,STANDARD_MESSAGE);
    }

    public static ControllerException throwItself(int type, String message){
        return new ControllerException(type,message);
    }

    public static ControllerException throwItself(String message){
        return new ControllerException(STANDARD_TYPE,message);
    }

}
